package com.hsylient.javase.chapter20;

import org.junit.Test;

public class PractiseMakesPerfect {

    @Test
    public void testCharConnection() {
        char c = 'a';
        int num = 10;
        String str = "hello";

        System.out.println(c + num + str);
        System.out.println(c + str + num);
        System.out.println(c + (num + str));
        System.out.println((c + num) + str);
        System.out.println(str + num + c);
    }

    @Test
    public void testChar() {
        System.err.println("*          *");
        System.err.println('*' + '\t' + '*');
        System.out.println('*' + "\t" + '*');
        System.out.println('*' + '\t' + "*");
        System.out.println('*' + ('\t' + "*"));
    }

    @Test
    public void testIncreaseByOneSelf() {
        int i1 = 10;
        int i2 = 20;
        int i = i1++;

        System.out.println("i=" + i);
        System.out.println("i1=" + i1);

        i = ++i1;

        System.out.println("i=" + i);
        System.out.println("i1=" + i1);

        i = i2--;

        System.out.println("i=" + i);
        System.out.println("i2=" + i2);

        i = --i2;

        System.out.println("i=" + i);
        System.out.println("i2=" + i2);
    }

    @Test
    public void max() {
        int[] ints = {0, 1, 2, 3, 4, 5, 6, 10, 7};
        int target = 0;
        for (int anInt : ints) {
            if (target < anInt) {
                target = anInt;
            }
        }
        System.out.println(target);
    }
}
